// ignore_for_file: prefer_const_constructors, prefer_const_literals_to_create_immutables, sort_child_properties_last, sized_box_for_whitespace, use_key_in_widget_constructors, implementation_imports, unnecessary_import, file_names

import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'controller.dart';

class NestedNavView extends GetView<NestedController>{

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("嵌套路由"),
        centerTitle: true,
      ),
      body: Container(
        color: Colors.amber,
        child: Column(
          children: <Widget>[
            Container(
              child: Text("占位条"),
              height: 100,
            ),
            SizedBox(
              height: 300,
              child: Navigator(
                key: Get.nestedKey(1),
                initialRoute: "/list",
                onGenerateRoute: controller.onGenerateRoute,
              ),
            ),
          ],
        ),
      ),
      bottomNavigationBar: Obx(
        () => BottomNavigationBar(
          items: <BottomNavigationBarItem>[
            BottomNavigationBarItem(
              icon: Icon(Icons.list),
              label: "列表"
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.my_library_music),
              label: "详情"
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.details),
              label: "我的"
            )
          ],
          currentIndex: controller.currentIndex.value,
          selectedItemColor: Colors.green[300],
          onTap: controller.changePage ,
        )
      ),
    );
  }

}